<template>
  <div>
    <iep-page-header title="我的订单" :backOption="backOption"></iep-page-header>
    <iep-table
      :isLoadTable="isLoadTable"
      :pagination="pagination"
      :dictsMap="dictsMap"
      :columnsMap="columnsMap"
      :pagedTable="pagedTable"
      @pagination-size-change="handlePaginationSizeChange"
      @pagination-current-change="handlePaginationCurrentChange"
    >
      <el-table-column prop="operation" label="操作" width="220" align="center">
        <template slot-scope="scope">
          <operation-wrapper>
            <iep-button type="warning" plain @click="handleDetail(scope.row)">详情</iep-button>
            <iep-button type="warning" plain @click="handleDelete(scope.row)">删除</iep-button>
          </operation-wrapper>
        </template>
      </el-table-column>
    </iep-table>
  </div>
</template>

<script>
// import { putProductById } from "@/api/dms/custom_module"
import { getWechatPlatformPage, deleteWechatById } from '@/api/order'
import { mapGetters } from 'vuex'
import Mixin from '@/mixins/mixins'
import operationMixins from '@/mixins/operationMixins'
import { columnsMap } from '../options'
export default {
  mixins: [operationMixins, Mixin],
  data () {
    return {
      backOption: {
        isBack: false
      },
      columnsMap
    }
  },
  computed: {
    ...mapGetters(['dictObject', 'dictMaps']),
    ...mapGetters(['userInfo']),
    dictsMap () {
      return {
        orderType: this.dictObject['product_type'],
        payStatus: this.dictObject['examine_status']
      }
    }
  },
  methods: {
    handleDetail (row) {
      this.$router.push(`/order-detail/${row.orderId}`)
    },
    handleDelete (row) {
      this._handleComfirm(row.orderId, deleteWechatById, '删除')
    },
    loadPage () {
      this.loadTable({}, getWechatPlatformPage)
    }
  },
  created () {
    this.loadPage()
  }
}
</script>
